<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>img</title>

    <style>

        img{
            height: 50px;
            width: 500px;
            position: relative;
        }

        img::before{
            content: "";
            display: block;
            position: absolute;
            top: -10px;
            left: 0;
            /* height: calc(100% + 10px); */
            height: 60px;
            width: 500px;
            /* width: 100%; */
            background-color: rgb(230, 230, 230);
            border: 2px dotted rgb(200, 200, 200);
            border-radius: 5px;
        }

        img::after{
            content: " Broken Image of " attr(alt);
            display: block;
            top: 5px;
            font-size: 16px;
            font-style: normal;
            font-family: FontAwesome;
            color: rgb(100, 100, 100);
            position: absolute;
            left: 0;
            width: 500px;
            /* width: 100%; */
            text-align: center;
        }
    </style>
</head>
<body>
    <img src="./nihao.jpg" alt="图片">
</body>
</html>